package com.unitd.frame.sso.service.plugin;

import com.unitd.frame.sso.common.token.Token;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @desc SSO 插件接口
 * @filename AbstractSSOPlugin.java
 * @copyright www.unitd.com
 * @author Hudan
 * @version 1.0
 * @date 2016/10/14
 */
public abstract class AbstractSSOPlugin {

	/**
	 * @desc 登录时调用该方法
	 * @param request  http请求对象
	 * @param response http相应对象
	 * @return 登录成功与否标识
	 */
	public abstract boolean login(HttpServletRequest request, HttpServletResponse response);

	/**
	 * @desc 退出时调用该方法
	 * @param request  http请求对象
	 * @param response http相应对象
	 * @return 退出成功与否标识
	 */
	public abstract boolean logout(HttpServletRequest request, HttpServletResponse response);

	/**
	 * @desc 验证 Token 的合法性(例如 time 超时验证)
	 * 登录后获取 Token 时调用该方法
	 * @param token 登录票据
	 * @return 验证成功与否
	 */
	public boolean validateToken(Token token) {
		return true;
	}
}